package com.pt25.study.example.interfaces.facade.test;


import com.pt25.base.res.ResBody;

import com.pt25.service.sys.rpc.SysRpcApi;
import com.pt25.service.sys.rpc.vo.RpcTestVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Slf4j
@Tag(name = "rpc test api")
@RefreshScope
@RestController
@RequestMapping("/test-rpc/example")
public class RpcTestController {
    private final static String TEST_RPC = "/test-rpc";
    @Resource
    private SysRpcApi sysRpcAPI;

    @Operation(summary = "测试rpc功能")
    @PostMapping(TEST_RPC)
    public ResBody testRedis(@RequestBody @Valid RpcTestVo rpcTestVo) {
        log.info("execute testRedis! rpcTestVo={}", rpcTestVo);
        return sysRpcAPI.testRpc(rpcTestVo);
    }
}
